﻿using System;
using System.Runtime.Serialization;

namespace NetBay.Core.BusinessEntities.TaskManager
{
    /// <summary>
    /// Represent a task
    /// </summary>
    [DataContract]
    public class TaskItem : ReturnObject
    {
        #region Properties

        /// <summary>
        /// Get or set the machine id
        /// </summary>
        [DataMember]
        public int MachineId { get; set; }

        /// <summary>
        /// Get or set the action type
        /// </summary>
        [DataMember]
        public TaskType Action { get; set; }

        /// <summary>
        /// Get or set the start time for this task
        /// </summary>
        [DataMember]
        public TimeSpan StartTime { get; set; }

        /// <summary>
        /// Get or set the end time for this task
        /// </summary>
        [DataMember]
        public TimeSpan EndTime { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Monday 
        /// </summary>
        [DataMember]
        public bool Monday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Tuesday 
        /// </summary>
        [DataMember]
        public bool Tuesday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Wednesday 
        /// </summary>
        [DataMember]
        public bool Wednesday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Thursday 
        /// </summary>
        [DataMember]
        public bool Thursday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Friday 
        /// </summary>
        [DataMember]
        public bool Friday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Saturday 
        /// </summary>
        [DataMember]
        public bool Saturday { get; set; }

        /// <summary>
        /// Get or set a value that indicate whether the task run each Sunday 
        /// </summary>
        [DataMember]
        public bool Sunday { get; set; }

        #endregion

        #region Constructors

        public TaskItem()
        {
            MachineId = 0;
            Action = 0;
            StartTime = new TimeSpan(0, 0, 0);
            EndTime = new TimeSpan(0, 0, 0);
            Monday = false;
            Tuesday = false;
            Wednesday = false;
            Thursday = false;
            Friday = false;
            Saturday = false;
            Sunday = false;
        }

        /// <summary>
        /// Only for error
        /// </summary>
        /// <param name="ErrorMessage"></param>
        /// <return></return>
        public TaskItem(string ErrorMessage)
            : base(ErrorMessage)
        {
        }

        #endregion

        public override string  ToString()
        {
            object[] args = {MachineId, Action, StartTime, EndTime, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday};
            return string.Format("Object TaskItem value are: (MachineId<{0}>) (Action<{1}>) (StartTime<{2}>) (EndTime<{3}>) (Monday<{4}>) (Tuesday<{5}>) (Wednesday<{6}>) (Thursday<{7}>) (Friday<{8}>) (Saturday<{9}>) (Sunday<{10}>)", args);
        }

    }
}
